import { Injectable } from '@angular/core';

/**
 * @Service
 * FormulaService
 * 作为公式id到公式string的映射服务
 * */
@Injectable({
  providedIn: 'root'
})
export class FormulaService {
  private static formulas = {
    //第一章, 行列式------------------------------------------------------------------------------
    'determinant-2x2':'D_2 = \\begin{vmatrix}\n' +
                      'a_{11} & a_{12} \\\\\n' +
                      'a_{21} & a_{22}\n' +
                      '\\end{vmatrix}',
    'determinant-2x2-equal' : '\\begin{vmatrix}\n' +
                              'a_{11} & a_{12} \\\\\n' +
                              'a_{21} & a_{22}\n' +
                              '\\end{vmatrix}\n' +
                              '= a_{11}a_{22} - a_{12}a_{21}',
    'square-OABC' : 'S_{\\square OABC} = \\begin{vmatrix}\n' +' a_{11} & a_{12} \\\\\n' +' a_{21} & a_{22}\n' +'\\end{vmatrix}',
    'determinant-text':'Div = \\begin{vmatrix}\n' +
      'A & B \\\\\n' +
      'C & D\n' +
      '\\end{vmatrix}',
    'determinant-converse' : 'Div^T = \\begin{vmatrix} A & C \\\\ B & D \\end{vmatrix}',
    'character-3' : '\\begin{vmatrix}\n' +
                    'k a_{11} & k a_{12} \\\\\n' +
                    'a_{21}   & a_{22}\n' +
                    '\\end{vmatrix}\n' +
                    '= k \\begin{vmatrix}\n' +
                    'a_{11} & a_{12} \\\\\n' +
                    'a_{21} & a_{22}\n' +
                    '\\end{vmatrix}\n' +
                    '= k (a_{11}a_{22} - a_{12}a_{21})',
    'character-4' : '\\begin{vmatrix}\n' +
                    'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_i1 + b_i1 & a_i2 + b_i2 & \\cdots & a_{in} + b_{in} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                    '\\end{vmatrix}\n' +
                    '=\\begin{vmatrix}\n' +
                    'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{i1} & a_{i2} & \\cdots & a_{in} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                    '\\end{vmatrix}\n' +
                    '+\\begin{vmatrix}\n' +
                    'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'b_{i1} & b_{i2} & \\cdots & b_{in} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                    '\\end{vmatrix}',
    'character-5' : '\\begin{vmatrix}\n' +
                    'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{i1} & a_{i2} & \\cdots & a_{in} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{j1} & a_{j2} & \\cdots & a_{jn} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                    '\\end{vmatrix}\n' +
                    '= -\\begin{vmatrix}\n' +
                    'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{j1} & a_{j2} & \\cdots & a_{jn} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{i1} & a_{i2} & \\cdots & a_{in} \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                    '\\end{vmatrix}',
    'determinant-definition-2' : '\\begin{vmatrix}\n' +
                                  'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                                  'a_{21} & a_{22} & \\cdots & a_{2n} \\\\\n' +
                                  '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                                  'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                                  '\\end{vmatrix}\n' +
                                  '= \\sum_{j_1j_2\\cdots j_n} (-1)^{r(j_1j_2\\cdots j_n)} a_{1j_1} a_{2j_2} \\cdots a_{nj_n}',
    'minor-definition' : 'M_{ij} = ' +
                          '\\begin{vmatrix}\n' +
                          'a_{11} & \\cdots & a_{1,j-1}  & a_{1,j+1} & \\cdots & a_{1n} \\\\\n' +
                          '\\vdots & \\ddots & \\vdots & \\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                          'a_{i-1,1} & \\cdots & a_{i-1,j-1} &  a_{i-1,j+1} & \\cdots & a_{i-1,n} \\\\\n' +
                          'a_{i+1,1} & \\cdots & a_{i+1,j-1} &  a_{i+1,j+1} & \\cdots & a_{i+1,n} \\\\\n' +
                          '\\vdots & \\ddots & \\vdots & \\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                          'a_{n1} & \\cdots & a_{n,j-1}  & a_{n,j+1} & \\cdots & a_{nn}\n' +
                          '\\end{vmatrix}\n' +
                          '_{(n-1)\\times(n-1)}',
    'determinant-expansion' : '\\left|A\\right| = \\begin{cases}\n' +
                              'a_{i1}A_{i1} + a_{i2}A_{i2} + \\cdots + a_{in}A_{in} = \\displaystyle\\sum_{j=1}^{n} a_{ij}A_{ij} & (i=1,2,\\ldots,n), \\\\\n' +
                              'a_{1j}A_{1j} + a_{2j}A_{2j} + \\cdots + a_{nj}A_{nj} = \\displaystyle\\sum_{i=1}^{n} a_{ij}A_{ij} & (j=1,2,\\ldots,n).\n' +
                              '\\end{cases}',
    'triangular-equal' : '\\begin{vmatrix}\n' +
                          'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                          '0      & a_{22} & \\cdots & a_{2n} \\\\\n' +
                          '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                          '0      & 0      & \\cdots & a_{nn}\n' +
                          '\\end{vmatrix}\n' +
                          '= \n' +
                          '\\begin{vmatrix}\n' +
                          'a_{11} & 0      & \\cdots & 0 \\\\\n' +
                          'a_{21} & a_{22} & \\cdots & 0 \\\\\n' +
                          '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                          'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                          '\\end{vmatrix}\n' +
                          '= \n' +
                          '\\begin{vmatrix}\n' +
                          'a_{11} & 0      & \\cdots & 0 \\\\\n' +
                          '0      & a_{22} & \\cdots & 0 \\\\\n' +
                          '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                          '0      & 0      & \\cdots & a_{nn}\n' +
                          '\\end{vmatrix}\n' +
                          '= \\displaystyle\\prod_{i=1}^{n} a_{ii}',
    'vice-triangular-equal' : '\\begin{vmatrix}\n' +
                              'a_{11} & \\cdots & a_{1,n-1} & a_{1n} \\\\\n' +
                              'a_{21} & \\cdots & a_{2,n-1} & 0 \\\\\n' +
                              '\\vdots & \\ddots & \\vdots & \\vdots \\\\\n' +
                              'a_{n1} & \\cdots & 0 & 0\n' +
                              '\\end{vmatrix}\n' +
                              '= \n' +
                              '\\begin{vmatrix}\n' +
                              '0 & \\cdots & 0 & a_{1n} \\\\\n' +
                              '0 & \\cdots & a_{2,n-1} & a_{2n} \\\\\n' +
                              '\\vdots & \\ddots & \\vdots & \\vdots \\\\\n' +
                              'a_{n1} & \\cdots & a_{n,n-1} & a_{nn}\n' +
                              '\\end{vmatrix}\n' +
                              '= \n' +
                              '\\begin{vmatrix}\n' +
                              '0 & \\cdots & 0 & a_{1n} \\\\\n' +
                              '0 & \\cdots & a_{2,n-1} & 0 \\\\\n' +
                              '\\vdots & \\ddots & \\vdots & \\vdots \\\\\n' +
                              'a_{n1} & \\cdots & 0 & 0\n' +
                              '\\end{vmatrix}\n' +
                              '= (-1)^{\\frac{n(n-1)}{2}} a_{1n} a_{2,n-1} \\cdots a_{n1}',
    'laplace-expansion' : '\\begin{vmatrix}\n' +
                          'A & O \\\\\n' +
                          'O & B\n' +
                          '\\end{vmatrix}\n' +
                          '= \n' +
                          '\\begin{vmatrix}\n' +
                          'A & C \\\\\n' +
                          'O & B\n' +
                          '\\end{vmatrix}\n' +
                          '= \n' +
                          '\\begin{vmatrix}\n' +
                          'A & O \\\\\n' +
                          'C & B\n' +
                          '\\end{vmatrix}\n' +
                          '= |A|\\cdot|B|, \\\\\n' +
                          '\\quad \\\\\n' +
                          '\\begin{vmatrix}\n' +
                          'O & A \\\\\n' +
                          'B & O\n' +
                          '\\end{vmatrix}\n' +
                          '= \n' +
                          '\\begin{vmatrix}\n' +
                          'C & A \\\\\n' +
                          'B & O\n' +
                          '\\end{vmatrix}\n' +
                          '= \n' +
                          '\\begin{vmatrix}\n' +
                          'O & A \\\\\n' +
                          'B & C\n' +
                          '\\end{vmatrix}\n' +
                          '= (-1)^{mn} |A|\\cdot|B|',
    'vandermonde' : '\\begin{vmatrix}\n' +
                    '1 & 1 & \\cdots & 1 \\\\\n' +
                    'x_1 & x_2 & \\cdots & x_n \\\\\n' +
                    'x_1^2 & x_2^2 & \\cdots & x_n^2 \\\\\n' +
                    '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                    'x_1^{n-1} & x_2^{n-1} & \\cdots & x_n^{n-1}\n' +
                    '\\end{vmatrix}\n' +
                    '= \\displaystyle\\prod_{1 \\leq i < j \\leq n} (x_j - x_i)',
    'determinant-calculation-1' : '\\begin{vmatrix}\n' +
                                  '1 & 1 & 1 & 1 \\\\\n' +
                                  '1 & 2 & 0 & 0 \\\\\n' +
                                  '1 & 0 & 3 & 0 \\\\\n' +
                                  '1 & 0 & 0 & 4\n' +
                                  '\\end{vmatrix}\n' +
                                  '\\overset{\\text{提出} 2}{\\longrightarrow} \\quad\n' +
                                  '\\begin{vmatrix}\n' +
                                  '1 & 1 & 1 & 1 \\\\\n' +
                                  '\\frac{1}{2} & 1 & 0 & 0 \\\\\n' +
                                  '1 & 0 & 3 & 0 \\\\\n' +
                                  '1 & 0 & 0 & 4\n' +
                                  '\\end{vmatrix}\n' +
                                  '\\overset{\\text{提出} 3}{\\longrightarrow} \\quad\n' +
                                  '\\begin{vmatrix}\n' +
                                  '1 & 1 & 1 & 1 \\\\\n' +
                                  '\\frac{1}{2} & 1 & 0 & 0 \\\\\n' +
                                  '\\frac{1}{3} & 0 & 1 & 0 \\\\\n' +
                                  '1 & 0 & 0 & 4\n' +
                                  '\\end{vmatrix}\n' +
                                  '\\overset{\\text{提出} 4}{\\longrightarrow} \\quad\n' +
                                  '\\begin{vmatrix}\n' +
                                  '1 & 1 & 1 & 1 \\\\\n' +
                                  '\\frac{1}{2} & 1 & 0 & 0 \\\\\n' +
                                  '\\frac{1}{3} & 0 & 1 & 0 \\\\\n' +
                                  '\\frac{1}{4} & 0 & 0 & 1\n' +
                                  '\\end{vmatrix}\n' +
                                  '\\\\\\overset{\\text{(-1)倍加至}}{\\longrightarrow} \\quad\n' +
                                  '\\begin{vmatrix}\n' +
                                  '1 & 1 & 1 & 1 \\\\\n' +
                                  '0 & 1 & -1 & -1 \\\\\n' +
                                  '0 & -1 & 1 & -1 \\\\\n' +
                                  '0 & -1 & -1 & 1\n' +
                                  '\\end{vmatrix}\n' +
                                  '\\overset{\\text{按此行展开}}{\\longrightarrow} \\quad\n' +
                                  '24 \\times \\left(1 - \\frac{1}{2} - \\frac{1}{3} - \\frac{1}{4}\\right)\n' +
                                  '= 24 - 12 - 8 - 6 = -2',
    'determinant-calculation-2' : '\\text{乘积的行列式} = \\begin{vmatrix} AB \\end{vmatrix} = \\begin{vmatrix} A \\end{vmatrix} \\cdot \\begin{vmatrix} B \\end{vmatrix}\n' +
                                  '\\quad \\Rightarrow \\quad |AB| = |A|\\cdot|B|',
    'determinant-calculation-3' : '\\text{由}\\quad\n' +
                                  'a_{i1}A_{i1} + a_{i2}A_{i2} + \\cdots + a_{in}A_{in} =\n' +
                                  '\\begin{vmatrix}\n' +
                                  'a_{i1} & a_{i2} & \\cdots & a_{in} \\\\\n' +
                                  '* & * & \\cdots & *\n' +
                                  '\\end{vmatrix},\\quad\\text{(①)}\n' +
                                  '\\quad\\overset{\\text{从右往左是展开}}{\\longrightarrow}\n' +
                                  '\\text{则}\\quad\n' +
                                  'k_1A_{i1} + k_2A_{i2} + \\cdots + k_nA_{in} =\n' +
                                  '\\begin{vmatrix}\n' +
                                  'k_1 & k_2 & \\cdots & k_n \\\\\n' +
                                  '* & * & \\cdots & *\n' +
                                  '\\end{vmatrix},\\quad\\text{(②)}\n' +
                                  '\\quad\\overset{\\text{大A配小k, k把小a吃}}{\\longrightarrow}\n' +
                                  '\\text{此为降阶运算, } A_{i1}, A_{i2}, \\ldots, A_{in} \\text{ 为 } n \\text{ 个 } n-1 \\text{ 阶行列式}',
    'determinant-calculation-4' : '\\text{由}\\quad\n' +
                                  'a_{i1}A_{i1} + a_{i2}A_{i2} + \\cdots + a_{in}A_{in} =\n' +
                                  '\\begin{vmatrix}\n' +
                                  'a_{i1} & a_{i2} & \\cdots & a_{in} \\\\\n' +
                                  '* & * & \\cdots & *\n' +
                                  '\\end{vmatrix},\\\\\\quad\\text{(①)}\n' +
                                  '\\quad\\overset{\\text{从右往左是展开}}{\\longrightarrow}\n' +
                                  '\\text{则}\\quad\n' +
                                  'k_1A_{i1} + k_2A_{i2} + \\cdots + k_nA_{in} =\n' +
                                  '\\begin{vmatrix}\n' +
                                  'k_1 & k_2 & \\cdots & k_n \\\\\n' +
                                  '* & * & \\cdots & *\n' +
                                  '\\end{vmatrix},\\\\\\quad\\text{(②)}\n' +
                                  '\\quad\\overset{\\text{大A配小k, k把小a吃}}{\\longrightarrow}\n' +
                                  '\\text{此为降阶运算, } A_{i1}, A_{i2}, \\ldots, A_{in} \\text{ 为 } n \\text{ 个 } n-1 \\text{ 阶行列式}',
    'linear-system' : '\\\n' +
                      '\\begin{cases}\n' +
                      'a_{11}x_1 + a_{12}x_2 + \\cdots + a_{1n}x_n = b_1 \\\\\n' +
                      'a_{21}x_1 + a_{22}x_2 + \\cdots + a_{2n}x_n = b_2 \\\\\n' +
                      '\\vdots \\\\\n' +
                      'a_{n1}x_1 + a_{n2}x_2 + \\cdots + a_{nn}x_n = b_n\n' +
                      '\\end{cases}',
    'determinant-nonzero': '\\\n' +
                            'D = \\begin{vmatrix}\n' +
                            'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
                            'a_{21} & a_{22} & \\cdots & a_{2n} \\\\\n' +
                            '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                            'a_{n1} & a_{n2} & \\cdots & a_{nn}\n' +
                            '\\end{vmatrix} \\ne 0',
    'cramers-rule': '\\text{克拉默法则（唯一解）}:\n' +
                    'x_i = \\dfrac{D_i}{D},\\quad i = 1,2,\\ldots,n',
    //第二章公式
    'matrix-mxn':'\\begin{bmatrix}\n' +
      'a_{11} & a_{12} & \\cdots & a_{1n} \\\\\n' +
      'a_{21} & a_{22} & \\cdots & a_{2n} \\\\\n' +
      '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
      'a_{m 1} & a_{m 2} & \\cdots & a_{mn}\n' +
      '\\end{bmatrix}',//mxn矩阵
    'kmatrix-mxn':'\\begin{bmatrix}\n' +
      'ka_{11} & ka_{12} & \\cdots & ka_{1n} \\\\\n' +
      'ka_{21} & ka_{22} & \\cdots & ka_{2n} \\\\\n' +
      '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
      'ka_{m 1} & ka_{m 2} & \\cdots & ka_{mn}\n' +
      '\\end{bmatrix}',//k倍mxn矩阵
    'AT':"\\boldsymbol{A}^{\\mathrm{T}} ",//A的转置
    'matrix-nxm':'\\begin{bmatrix}\n' +
      'a_{11} & a_{21} & \\cdots & a_{m1} \\\\\n' +
      'a_{12} & a_{22} & \\cdots & a_{m2} \\\\\n' +
      '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
      'a_{1n} & a_{2n} & \\cdots & a_{mn}\n' +
      '\\end{bmatrix}',//nxm矩阵
    'A-1':"\\boldsymbol{A}^{\\mathrm{-1}} ",//A的逆
    "|A|":"|\\boldsymbol{A}|",//A的行列式
    'A*':"\\boldsymbol{A}^{\\mathrm{*}} ",//A的转置
    'A*mxn':
      "\\boldsymbol{A}^{*} = \\left[\\begin{array}{cccc}\n" +
      "A_{11} & A_{21} & \\cdots & A_{n1} \\\\\n" +
      "A_{12} & A_{22} & \\cdots & A_{n2} \\\\\n" +
      "\\vdots & \\vdots & \\ddots & \\vdots \\\\\n" +
      "A_{1n} & A_{2n} & \\cdots & A_{nn}\n" +
      "\\end{array}\\right]\n",// A的转置mxn矩阵

    //----------------------------------------------------第三章向量组
    'vector-group': '\\\n' +
                    '\\begin{bmatrix}\n' +
                    '1 & 6 & 2 \\\\\n' +
                    '2 & 7 & 4 \\\\\n' +
                    '3 & 9 & 6\n' +
                    '\\end{bmatrix} \\\\\n' +
                    '\\begin{matrix}\n' +
                    '\\mathbf{a}_1 & \\mathbf{a}_2 & \\mathbf{a}_3\n' +
                    '\\end{matrix}',
    'cos-theta': '\\\n' +
                  '\\cos\\theta = \\frac{( a, \\beta )}{\\|a\\| \\cdot \\|\\beta\\|}',
    'inner-product-and-norm': '\\\n' +
                              '( \\mathbf{a}, \\mathbf{\\beta} ) = a_1b_1 + a_2b_2 + \\cdots + a_nb_n, \\\\\n' +
                              '\\|\\mathbf{a}\\| = \\sqrt{a_1^2 + a_2^2 + \\cdots + a_n^2}, \\\\\n' +
                              '\\|\\mathbf{\\beta}\\| = \\sqrt{b_1^2 + b_2^2 + \\cdots + b_n^2}',
    'inner-product-sum': '\\\n' +
                          '( \\mathbf{a}, \\mathbf{\\beta} ) = \\mathbf{a}^T \\mathbf{\\beta} = \\sum_{i=1}^{n} a_i b_i = a_1b_1 + a_2b_2 + \\cdots + a_n b_n',
    'orthonormal-definition': '\\\n' +
                              'a_i^T a_j = \\begin{cases}\n' +
                              '0, & i \\ne j, \\\\\n' +
                              '1, & i = j,\n' +
                              '\\end{cases}',
    'orthogonal-matrix-definition': '\\\n' +
                                    '设 A 是 n 阶方阵，满足 A^T A = E，则称 A 是正交矩阵。\\\\\n' +
                                    'A 是正交矩阵 \\Leftrightarrow A^T A = E \\Leftrightarrow A^T = A^{-1} \\Leftrightarrow A 的行（列）向量组是规范正交基。',
    'column-vectors': '\\\n' +
                      '\\mathbf{a}_1 = [a_{11}, a_{21}, \\cdots, a_{n1}]^T, \\\\\n' +
                      '\\mathbf{a}_2 = [a_{12}, a_{22}, \\cdots, a_{n2}]^T, \\\\\n' +
                      '\\cdots \\\\\n' +
                      '\\mathbf{a}_m = [a_{1m}, a_{2m}, \\cdots, a_{nm}]^T',
    'linear-combination-zero': '\\\n' +
                                '[\\mathbf{a}_1, \\mathbf{a}_2, \\cdots, \\mathbf{a}_m]\n' +
                                '\\begin{bmatrix}\n' +
                                'x_1 \\\\\n' +
                                'x_2 \\\\\n' +
                                '\\vdots \\\\\n' +
                                'x_m\n' +
                                '\\end{bmatrix}\n' +
                                '= x_1 \\mathbf{a}_1 + x_2 \\mathbf{a}_2 + \\cdots + x_m \\mathbf{a}_m = \\mathbf{0}',
    'linear-combination-beta': '\\\n' +
                                '[\\mathbf{a}_1, \\mathbf{a}_2, \\cdots, \\mathbf{a}_m]\n' +
                                '\\begin{bmatrix}\n' +
                                'x_1 \\\\\n' +
                                'x_2 \\\\\n' +
                                '\\vdots \\\\\n' +
                                'x_m\n' +
                                '\\end{bmatrix}\n' +
                                '= x_1 \\mathbf{a}_1 + x_2 \\mathbf{a}_2 + \\cdots + x_m \\mathbf{a}_m = \\mathbf{β}',
    //---------------------------------------第五章特征值与特征向量
    'characteristic-polynomial': '\\\n' +
                                  '\\overset{②}{\\left| \\lambda E - A \\right| = \\begin{vmatrix}\n' +
                                  '\\lambda - a_{11} & -a_{12} & \\cdots & -a_{1n} \\\\\n' +
                                  '-a_{21} & \\lambda - a_{22} & \\cdots & -a_{2n} \\\\\n' +
                                  '\\vdots & \\vdots & \\ddots & \\vdots \\\\\n' +
                                  '-a_{n1} & -a_{n2} & \\cdots & \\lambda - a_{nn}\n' +
                                  '\\end{vmatrix} = 0}',
    'eigenvalue-properties': '\\\n' +
                              '(1)\\quad \\lambda_0 \\text{ 是 } A \\text{ 的特征值 } \\Leftrightarrow \\left| \\lambda_0 E - A \\right| = 0, \\\\\n' +
                              '\\quad \\lambda_0 \\text{ 不是 } A \\text{ 的特征值 } \\Leftrightarrow \\left| \\lambda_0 E - A \\right| \\ne 0. \\\\\n' +
                              '(2)\\quad \\text{若 } \\lambda_1, \\lambda_2, \\ldots, \\lambda_n \\text{ 是 } A \\text{ 的 } n \\text{ 个特征值，则} \\\\\n' +
                              '\\quad \\begin{cases}\n' +
                              ' |A| = \\lambda_1 \\lambda_2 \\cdots \\lambda_n, \\\\\n' +
                              ' \\mathrm{tr}(A) = \\lambda_1 + \\lambda_2 + \\cdots + \\lambda_n.\n' +
                              '\\end{cases}',
    'eigen-vector-properties-full': '\\\n' +
                                    '(1)\\quad \\xi (\\ne \\mathbf{0}) \\text{ 是 } A \\text{ 的属于 } \\lambda_0 \\text{ 的特征向量} \\\\\n' +
                                    '\\quad \\Leftrightarrow \\xi \\text{ 是方程 } (\\lambda_0 E - A)x = \\mathbf{0} \\text{ 的非零解。} \\\\\n' +
                                    '(2)\\quad \\text{重要结论：} \\\\\n' +
                                    '\\quad ①\\ k \\text{ 重特征值 } \\lambda \\text{ 至多只有 } k \\text{ 个线性无关的特征向量。} \\\\\n' +
                                    '\\quad ②\\ \\text{若 } \\xi_1, \\xi_2 \\text{ 是 } A \\text{ 的属于不同特征值 } \\lambda_1, \\lambda_2 \\text{ 的特征向量，} \\\\\n' +
                                    '\\quad \\text{则 } \\xi_1, \\xi_2 \\text{ 线性无关。} \\\\\n' +
                                    '(3)\\quad \\text{若 } \\xi_1, \\xi_2 \\text{ 是 } A \\text{ 的属于同一特征值 } \\lambda \\text{ 的特征向量，} \\\\\n' +
                                    '\\quad \\text{则非零向量 } k_1\\xi_1 + k_2\\xi_2 \\text{ 仍是 } A \\text{ 的属于特征值 } \\lambda \\text{ 的特征向量。} \\\\\n' +
                                    '(4)\\quad \\text{若 } \\xi_1, \\xi_2 \\text{ 是 } A \\text{ 的属于不同特征值 } \\lambda_1, \\lambda_2 \\text{ 的特征向量，} \\\\\n' +
                                    '\\quad \\text{则当 } k_1 \\ne 0, k_2 \\ne 0 \\text{ 时，} k_1\\xi_1 + k_2\\xi_2 \\text{ 不是 } A \\text{ 的任何特征值的特征向量。} \\\\\n' +
                                    '(5)\\quad \\text{设 } \\lambda_1, \\lambda_2 \\text{ 是 } A \\text{ 的两个不同的特征值，} \\xi \\text{ 是对应于 } \\lambda_1 \\text{ 的特征向量，} \\\\\n' +
                                    '\\quad \\text{则 } \\xi \\text{ 不是对应于 } \\lambda_2 \\text{ 的特征向量。} \\\\\n' +
                                    '\\quad \\text{（即：一个特征向量不能属于两个不同的特征值。）}',
    'eigen-table': '\\\n' +
                    '\\begin{array}{|c|c|c|c|c|c|c|c|}\n' +
                    '\\hline\n' +
                    '\\text{矩阵} & A & kA & A^k & f(A) & A^{-1} & A^* & P^{-1}AP \\\\\n' +
                    '\\hline\n' +
                    '\\text{特征值} & \\lambda & k\\lambda & \\lambda^k & f(\\lambda) & \\dfrac{1}{\\lambda} & \\dfrac{|A|}{\\lambda} & \\lambda \\\\\n' +
                    '\\hline\n' +
                    '\\text{对应的特征向量} & \\xi & \\xi & \\xi & \\xi & \\xi & \\xi & P^{-1}\\xi \\\\\n' +
                    '\\hline\n' +
                    '\\end{array}',
    'block-diagonal-similarity': '\\\n' +
                                  '\\begin{bmatrix}\n' +
                                  'A & O \\\\\n' +
                                  'O & B\n' +
                                  '\\end{bmatrix}\n' +
                                  '\\sim\n' +
                                  '\\begin{bmatrix}\n' +
                                  'C & O \\\\\n' +
                                  'O & D\n' +
                                  '\\end{bmatrix}',
    'diagonalization': '\\\n' +
                        'P = [\\xi_1, \\xi_2, \\ldots, \\xi_n],\\quad A = \\begin{bmatrix}\n' +
                        '\\lambda_1 & & & \\\\\n' +
                        '& \\lambda_2 & & \\\\\n' +
                        '& & \\ddots & \\\\\n' +
                        '& & & \\lambda_n\n' +
                        '\\end{bmatrix}',
    'matrix-diagonalization-form': '\\\n' +
                                    'A[\\xi_1, \\xi_2, \\ldots, \\xi_n] = [\\xi_1, \\xi_2, \\ldots, \\xi_n] \\begin{bmatrix}\n' +
                                    '\\lambda_1 & & & \\\\\n' +
                                    '& \\lambda_2 & & \\\\\n' +
                                    '& & \\ddots & \\\\\n' +
                                    '& & & \\lambda_n\n' +
                                    '\\end{bmatrix}',
    'eigen-vector-transform': '\\\n' +
                              '[A\\xi_1, A\\xi_2, \\ldots, A\\xi_n] = [\\lambda_1\\xi_1, \\lambda_2\\xi_2, \\ldots, \\lambda_n\\xi_n]',
    'eigen-equation-single': '\\\n' +
                              'A\\xi_i = \\lambda_i \\xi_i,\\ i=1,2,\\ldots,n',
    'similarity-diagonalization': '\\\n' +
                                  'P^{-1}AP = \\Lambda = \\begin{bmatrix}\n' +
                                  '\\lambda_1 & & & \\\\\n' +
                                  '& \\lambda_2 & & \\\\\n' +
                                  '& & \\ddots & \\\\\n' +
                                  '& & & \\lambda_n\n' +
                                  '\\end{bmatrix}',
    'diagonalization-2d': '\\\n' +
                          '[\\xi_1, \\xi_2]^{-1} A [\\xi_1, \\xi_2] = \\begin{bmatrix}\n' +
                          '\\lambda_1 & \\\\\n' +
                          '& \\lambda_2\n' +
                          '\\end{bmatrix}\n' +
                          '\\quad \\Rightarrow \\quad\n' +
                          'A = [\\xi_1, \\xi_2] \\begin{bmatrix}\n' +
                          '\\lambda_1 & \\\\\n' +
                          '& \\lambda_2\n' +
                          '\\end{bmatrix} [\\xi_1, \\xi_2]^{-1}',
    'diagonalization-power-function': '\\\n' +
                                      '\\text{按照 4，进一步地，当 } A \\sim \\Lambda = \\begin{bmatrix}\n' +
                                      '\\lambda_1 & & & \\\\\n' +
                                      '& \\lambda_2 & & \\\\\n' +
                                      '& & \\ddots & \\\\\n' +
                                      '& & & \\lambda_n\n' +
                                      '\\end{bmatrix} \\text{ 时，有} \\\\\n' +
                                      '\\\\\n' +
                                      'P^{-1}A^kP = \\Lambda^k,\\quad A^k = P\\Lambda^kP^{-1} = P\\begin{bmatrix}\n' +
                                      '\\lambda_1^k & & & \\\\\n' +
                                      '& \\lambda_2^k & & \\\\\n' +
                                      '& & \\ddots & \\\\\n' +
                                      '& & & \\lambda_n^k\n' +
                                      '\\end{bmatrix}P^{-1}, \\\\\n' +
                                      '\\\\\n' +
                                      'P^{-1}f(A)P = f(\\Lambda),\\quad f(A) = Pf(\\Lambda)P^{-1} = P\\begin{bmatrix}\n' +
                                      'f(\\lambda_1) & & & \\\\\n' +
                                      '& f(\\lambda_2) & & \\\\\n' +
                                      '& & \\ddots & \\\\\n' +
                                      '& & & f(\\lambda_n)\n' +
                                      '\\end{bmatrix}P^{-1}.',
  };

  static getFormula(id: string): string {
    // @ts-ignore
    return this.formulas[id] || null;
  }
}
